using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using SailHero.Soft.FrameWork.Models;

namespace SailHero.Soft.FrameWork.Mapping.HJT212DB
{
    public class CodeTypeMap : EntityTypeConfiguration<CodeType>
    {
        public CodeTypeMap()
        {
            // Primary Key
            this.HasKey(t => t.TypeID);

            // Properties
            this.Property(t => t.TypeID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.TypeName)
                .IsRequired()
                .HasMaxLength(60);

            this.Property(t => t.Diminutive)
                .HasMaxLength(20);

            this.Property(t => t.StdCodeColl)
                .HasMaxLength(250);

            this.Property(t => t.TypeMean)
                .HasMaxLength(254);

            // Table & Column Mappings
            this.ToTable("CodeType");
            this.Property(t => t.TypeID).HasColumnName("TypeID");
            this.Property(t => t.TypeName).HasColumnName("TypeName");
            this.Property(t => t.Diminutive).HasColumnName("Diminutive");
            this.Property(t => t.StdCodeColl).HasColumnName("StdCodeColl");
            this.Property(t => t.AllowChanged).HasColumnName("AllowChanged");
            this.Property(t => t.TypeMean).HasColumnName("TypeMean");
            this.Property(t => t.ItemLen).HasColumnName("ItemLen");
            this.Property(t => t.TypeItemDate).HasColumnName("TypeItemDate");
            this.Property(t => t.MaxInputLen).HasColumnName("MaxInputLen");
            this.Property(t => t.MaxNameLen).HasColumnName("MaxNameLen");
        }
    }
}
